//
//  ZBMacroConstant.h
//  ZBCommon
//
//  Created by Apple on 2017/9/26.
//  Copyright © 2017年 Apple. All rights reserved.
//

#ifndef UIMacrosConstant_h
#define UIMacrosConstant_h

//自定义尺寸
#define UI_NAVI_STATUSBAR_HEIGHT  (IPHONE_X || IPHONE_XR) ? 44.0: 20.0
#define UI_NAVI_BAR_HEIGHT 44.0
#define UI_NAVI_HEIGHT  (UI_NAVI_STATUSBAR_HEIGHT + UI_NAVI_BAR_HEIGHT)
#define UI_TABBAR_HEIGHT  49.0
#define UI_SCREEN_WIDTH  [[UIScreen mainScreen] bounds].size.width
#define UI_SCREEN_HEIGHT  [[UIScreen mainScreen] bounds].size.height
#define UI_AUTO_FIT_WIDTH(width)     ((width) / 375.0f * (UI_SCREEN_WIDTH))
#define UI_AUTO_FIT_HEIGHT(height)   ((height) / 667.0f * (UI_SCREEN_HEIGHT))

//弱引用
#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;

//自定义特殊的数字
#define kRequestMaxCount 10

//只在debug下才输出日志, 在程序运行时取消log
#ifdef DEBUG
#define ZBLog(...)  NSLog(__VA_ARGS__)
#else
#define ZBLog(...)
#endif


#define ZB_suppressPerformSelectorLeakWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)

//自定义方法
#define  ZBSystemVersion [[[UIDevice currentDevice] systemVersion] floatValue]
#define  ZB_PUSH_VC(vc)       [self.navigationController pushViewController:vc animated:YES];
#define  ZB_POP               [self.navigationController popViewControllerAnimated:YES];
#define  ZB_PRESENT_VC(vc)    [self presentViewController:vc animated:YES completion:nil];
#define  ZB_DIMISS            [self diZBissViewControllerAnimated:YES completion:nil]
//定义UIImage对象
#define ZBImageFileName(_file_)  [UIImage imageWithContentsOfFile:[NSBundle mainBundle] pathForResource:_file_ ofType:nil]

//定义UIImage对象
#define ZBImageNamed(_pointer) [UIImage imageNamed:_pointer]


//系统版本
#define  ZB_SystemVersion_UP_7_0   ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0)
#define  ZB_SystemVersion_UP_8_0   ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0)
#define  ZB_SystemVersion_UP_9_0   ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0)
#define  ZB_SystemVersion_UP_10_0   ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0)
#define  ZB_SystemVersion_UP_11_0   ([[UIDevice currentDevice].systemVersion floatValue] >= 11.0)


//各种设备屏幕尺寸
#define IPHONE4  (([UIScreen mainScreen].bounds.size.width == 320) && ([UIScreen mainScreen].bounds.size.height == 480)) || (([UIScreen mainScreen].bounds.size.width == 480) && ([UIScreen mainScreen].bounds.size.height == 320))
#define IPHONE5  (([UIScreen mainScreen].bounds.size.width == 320) && ([UIScreen mainScreen].bounds.size.height == 568)) || (([UIScreen mainScreen].bounds.size.width == 568) && ([UIScreen mainScreen].bounds.size.height == 320))
#define IPHONE6_IPHONE7  (([UIScreen mainScreen].bounds.size.width == 375) && ([UIScreen mainScreen].bounds.size.height == 667)) || (([UIScreen mainScreen].bounds.size.width == 667) && ([UIScreen mainScreen].bounds.size.height == 375))
#define IPHONE6P_IPHONE7P  (([UIScreen mainScreen].bounds.size.width == 414) && ([UIScreen mainScreen].bounds.size.height == 736)) || (([UIScreen mainScreen].bounds.size.width == 736) && ([UIScreen mainScreen].bounds.size.height == 414))
#define IPHONE_X (([UIScreen mainScreen].bounds.size.width == 375) && ([UIScreen mainScreen].bounds.size.height == 812)) || (([UIScreen mainScreen].bounds.size.width == 812) && ([UIScreen mainScreen].bounds.size.height == 375))
#define IPHONE_XR (([UIScreen mainScreen].bounds.size.width == 414) && ([UIScreen mainScreen].bounds.size.height == 896)) || (([UIScreen mainScreen].bounds.size.width == 896) && ([UIScreen mainScreen].bounds.size.height == 414))


/**颜色转换**/
#define ZBColorChangeRGB(colorchange,alpa)  [UIColor colorWithRed:(CGFloat)(((colorchange &0xff0000)>>16)/255.0) green:(CGFloat)(((colorchange &0xff00)>> 8)/255.0 )blue:(CGFloat)((colorchange & 0xff)/255.0 ) alpha:alpa]

//设置Rect
#define ZBRect(x,y,w,h) CGRectMake(x, y, w, h)

//设置size
#define ZBSize(w,h) CGSizeMake(w, h)

//设置point
#define ZBPoint(x,y) CGPointMake(x, y)

#endif /* ZBMacroConstant_h */
